#include "People.h"
int People::PID=0;
People::People(string name,string address,string job):Name(name),Address(address),Job(job)
{
    op = new Operate;
    if(PID == 0)
    {
        PID = op->getMax("PID", "people");
        if(PID < 0)
            PID = 0;
    }
    PID++;
}

People::~People()
{
    delete op;
}
int People::getPID()
{
    return PID;
}
void People::setPID(const int& pid)
{
    this->PID=pid;
}
string People::getName()
{
    return Name;
}
void People::setName(const string& name)
{
    this->Name=name;
}
string People::getAddress()
{
    return Address;
}
void People::setAddress(const string& address)
{
    this->Address=address;
}
string People::getJob()
{
    return Job;
}
void People::setJob(const string& job)
{
    this->Job=job;
}
bool People::getState()
{
    return State;
}
void People::setState(const bool& state)
{
    this->State=state;
}
void People::sub()
{
    string sql("");
    char id[64]={0};
    sql+="insert into People(PID,Name,Address,Job,State) value(\'";
    sql+=PID+'0';
    sql+="\', \'";
    sql+=Name;
    sql+="\', \'";
    sql+=Address;
    sql+="\', \'";
    sql+=Job;
    sql+="\', \'";
    sql+='1';
    op->Insert(sql);
}
